package com.jokins.common.from;

import com.jokins.common.actions.enty.CommonEntity;
import lombok.Data;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;

import java.util.function.Supplier;

/**
 * 〈〉<br>
 *
 * @author Mr.Wang
 * @create 2024/12/1
 */
@Data
public class BaseFrom {
    private String id;

    public <T extends CommonEntity> T toPo(@NotNull final Supplier<? extends T> ctor) {
        final T po = ctor.get();
        BeanUtils.copyProperties(this, po);
        return po;
    }
}